const mysql = require('mysql');

const con = mysql.createConnection({
    host: 'localhost',
    user: 'me',
    password: 'secret',
    port: '3306',
    database: 'myblog',
});

con.connect();

// const sql = 'select * from users';
// const sql = 'select id, username from users';
// const sql = `update users set realname='李四2' where username='lisi'`;
const sql = `insert into blogs (title, content, createtime, author) values ('标题C', '内容C', 1636182448777, 'zhangsan')`;
con.query(sql, (err, result) => {
    if (err) {
        console.error(err);
        return;
    }

    console.log(result);
});

con.end();
